﻿@{
    Layout = "_LayoutIndex";
}
@model LoginedPageModel
@section css{
    <link href="~/media/css/bootstrap-tag.css" rel="stylesheet" type="text/css" />

    <link href="~/media/css/bootstrap-wysihtml5.css" rel="stylesheet" type="text/css" />

    <link href="~/media/css/jquery.fancybox.css" rel="stylesheet" />

    <link href="~/media/css/bootstrap-wysihtml5.css" rel="stylesheet" type="text/css" />
}
<div class="page-header-fixed">
    
    <div class="page-container row-fluid">

        <!-- BEGIN SIDEBAR -->

        <div class="page-sidebar nav-collapse collapse">

            <!-- BEGIN SIDEBAR MENU -->

            @Html.Partial("Partials/MenuPartial.cshtml")

            <!-- END SIDEBAR MENU -->

        </div>

        <!-- END SIDEBAR -->
        <!-- BEGIN PAGE -->
        <div class="page-content">
            <div class="container-fluid">
                @RenderBody()
            </div>
        </div>
        <!-- END PAGE -->

    </div>
</div>
@section Scripts{ 
<script src="~/lib/ace-builds/src-noconflict/ace.js"></script>

<script src="~/lib/js-beautify/js/lib/beautify.js"></script>
<script src="~/lib/clipboard/dist/clipboard.js"></script>
<script src="~/lib/ace-builds/src-noconflict/theme-github.js"></script>
<script src="~/lib/ace-builds/src-noconflict/theme-sqlserver.js"></script>
<script src="~/js/site.js"></script>
@RenderSection("Scripts", required: false)
    <script >
        //var beautify = ace.require("ace/ext/beautify");
        ace.config.set('basePath', '/lib/ace-builds/src-noconflict');
        ace.config.set('modePath', '/lib/ace-builds/src-noconflict');
        ace.config.set('themePath', '/lib/ace-builds/src-noconflict');
        $(document).ready(function () {

            $(".aceEditor").each(function (index, ele) {

                var editor = ace.edit(ele);
                var session = editor.getSession();
                editor.setTheme("ace/theme/sqlserver");
                session.setMode("ace/mode/csharp");
                //session.setValue(js_beautify(session.getValue()));
            });

            var clipboard = new Clipboard('.copybtn', {
                text: function (trigger) {
                    var target = $(trigger).attr("data-clipboard-acetarget");
                    if (target.length > 0) {
                        var element = $(target);
                        var editor = ace.edit(target);
                        return editor.getValue();
                    }

                    return "";
                }
            });

            var subMenu = $(".page-sidebar-menu>li:eq(@(Model.SubIndex))");
            $(subMenu).addClass('active');

            if (@(Model.Index) > -1) {

                var menu = $(subMenu).find('.sub-menu > li:eq(@(Model.Index))');
                $(menu).addClass('active');
            }

        });
    </script>  
}
